package com.chaos.eurekaproducer.delayQueue;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author liaopeng
 * @title: DelayQueueController
 * @projectName eureka-producer
 * @description: TODO
 * @date 2021/8/17上午10:24
 */
@RestController
@RequestMapping("/delay")
public class DelayQueueController {
    @Autowired
    private DelayQueueManage delayQueueManage;

    @GetMapping("/add")
    public void testDelayQueue(){
        try {
            String time="20210817102800";
            SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
            Date date = format.parse(time);
            date.getTime();
            MyDelayEntity order = new MyDelayEntity(1L,date.getTime());
            delayQueueManage.add(order);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
